Extending a virtual machine instruction set architecture

ABSTRACT

Operations include a compilation process and a runtime process. A compiler compiles code to generate virtual machine instructions. The compiler further generates information referencing respective parameter types of the parameters of a target virtual machine instruction. The compiler stores the information external to and in association with the target virtual machine instruction. The information may be included in another virtual machine instruction that precedes the target virtual machine instruction. A runtime environment processes the target virtual machine instruction based on the information stored external to and in association with the target virtual machine instruction. Parameter types referenced by the external information override parameter types that are (a) referenced by the target virtual machine instruction itself, (b) deduced by the runtime environment and/or (c) stored directly in association with the parameter values.

PRIORITY CLAIM; INCORPORATION BY REFERENCE

Each of the following applications are hereby incorporated by reference:application Ser. No. 15/948,587, filed on Apr. 9, 2018; application Ser.No. 15/005,448, filed on Jan. 25, 2016; application No. 62/202,909,filed on Aug. 9, 2015; The Applicant hereby rescinds any disclaimer ofclaim scope in the parent application(s) or the prosecution historythereof and advises the USPTO that the claims in this application may bebroader than any claim in the parent application(s).

TECHNICAL FIELD

The present disclosure relates to extending a virtual machineinstruction set architecture. In particular, the present disclosurerelates to information that is (a) stored external to and in associationwith a virtual machine instruction and (b) references parameter typesfor parameters of the virtual machine instruction.

Furthermore, each of the following patent applications are herebyincorporated by reference as if included herein:

-   -   (a) application Ser. No. 14/699,141 filed Apr. 29, 2015 titled        “Speeding Up Dynamic Language Execution on a Virtual Machine        with Type Speculation”;    -   (b) application Ser. No. 14/699,129 filed Apr. 29, 2015 titled        “Handling Value Types”;    -   (c) application Ser. No. 14/660,143 filed Mar. 17, 2015 titled        “Metadata-Driven Dynamic Specialization”;    -   (d) application Ser. No. 14/660,177 filed Mar. 17, 2015 titled        “Structural Identification of Dynamically Generated,        Pattern-Instantiation, Generated Classes”;    -   (e) application Ser. No. 14/660,604 filed Mar. 17, 2015 titled        “Decomposing a Generic Class into Layers”;    -   (f) application Ser. No. 14/685,386 filed Apr. 13, 2015 titled        Target “Typing-dependent Combinatorial Code Analysis”;    -   (g) application Ser. No. 14/692,590 filed Apr. 21, 2015 titled        “Dependency-driven Co-Specialization of Specialized Classes”;    -   (h) application Ser. No. 14/692,592 filed Apr. 21, 2015 titled        “Partial Specialization of Generic Classes”;    -   (i) application Ser. No. 14/692,593 filed Apr. 21, 2015 titled        “Manual Refinement of Specialized Classes”;    -   (j) application Ser. No. 14/692,601 filed Apr. 21, 2015 titled        “Wholesale Replacement of Specialized Classes”; and    -   (k) application Ser. No. 14/743,912 filed Jun. 18, 2015 titled        “Optimistically Assuming Types in a Dynamically Typed Language.”

BACKGROUND

An instruction set, or instruction set architecture (ISA), is the partof the computer architecture related to programming, including thenative data types, instructions, registers, addressing modes, memoryarchitecture, interrupt and exception handling, and external I/O. An ISAincludes a specification of the set of opcodes (machine language), andthe native commands implemented by a particular processor.

Java bytecode is the instruction set of the Java Virtual Machine (JVM)generated by a compiler (e.g., the javac compiler). Each bytecode iscomposed by one, or in some cases two, bytes that represent theinstruction (opcode), along with zero or more bytes for passingparameters. Some opcodes are applicable to specific parameter types. Forexample, opcode “60” (mnemonic “iadd”) adds two values of type integer.In another example, opcode “62” (mnemonic “fadd”) adds two values oftype float. Details regarding the structure of the JVM are includedherewith in Appendix A. Details regarding the JVM instructions set areincluded herewith in Appendix B.

An optimizing compiler is a compiler that minimizes or maximizes someattributes of an executable computer program. For example, an optimizingcompiler may be configured for increasing run-time performance, ordecreasing the amount of memory utilized by the program. Compileroptimization is often implemented using a sequence of optimizingtransformations, algorithms that take a program and transform it toproduce a semantically equivalent output program that uses fewerresources or executes more quickly. Compiler optimizations can bedivided into multiple categories, such as loop optimizations, data-flowoptimizations, SSA-based optimizations, code generator optimizations,bounds-checking eliminations, dead code limitations, and so forth.

The approaches described in this section are approaches that could bepursued, but not necessarily approaches that have been previouslyconceived or pursued. Therefore, unless otherwise indicated, it shouldnot be assumed that any of the approaches described in this sectionqualify as prior art merely by virtue of their inclusion in thissection.

BRIEF DESCRIPTION OF THE DRAWINGS

The embodiments are illustrated by way of example and not by way oflimitation in the figures of the accompanying drawings. It should benoted that references to “an” or “one” embodiment in this disclosure arenot necessarily to the same embodiment, and they mean at least one. Inthe drawings:

FIG. 1 illustrates an example computing architecture in which techniquesdescribed herein may be practiced.

FIG. 2 is a block diagram illustrating one embodiment of a computersystem suitable for implementing methods and features described herein.

FIG. 3 illustrates an example virtual machine memory layout in blockdiagram form according to one or more embodiments.

FIG. 4 illustrates an example frame in block diagram form according toone or more embodiments.

FIG. 5 illustrates bytecode in accordance with one or more embodiments.

FIG. 6 illustrates a set of operations for processing a virtual machineinstruction in accordance with one or more embodiments.

FIG. 7 illustrates a system in accordance with one or more embodiments.

DETAILED DESCRIPTION

In the following description, for the purposes of explanation, numerousspecific details are set forth in order to provide a thoroughunderstanding. One or more embodiments may be practiced without thesespecific details. Features described in one embodiment may be combinedwith features described in a different embodiment. In some examples,well-known structures and devices are described with reference to ablock diagram form in order to avoid unnecessarily obscuring the presentinvention.

-   -   1. GENERAL OVERVIEW    -   2. ARCHITECTURAL OVERVIEW        -   2.1 EXAMPLE CLASS FILE STRUCTURE        -   2.2 EXAMPLE VIRTUAL MACHINE ARCHITECTURE        -   2.3 LOADING, LINKING, AND INITIALIZING    -   3. EXTENDING A VIRTUAL MACHINE INSTRUCTION SET ARCHITECTURE        -   3.1 REFERENCING PARAMETER TYPES FOR VIRTUAL MACHINE            INSTRUCTIONS        -   3.2 PROCESSING VIRTUAL MACHINE INSTRUCTIONS BASED ON            EXTERNALLY REFERENCED PARAMETER TYPES        -   3.3 EXAMPLE USES OF REFERENCED PARAMETER TYPES    -   4. MISCELLANEOUS; EXTENSIONS    -   5. HARDWARE OVERVIEW

1. General Overview

Embodiments relate to the generation and use of information referencinga parameter type of a parameter of a target virtual machine instruction.The information may reference a variable corresponding to a type valuestored at a particular location (e.g., index) in a constant pool. Thevariable may correspond to a MethodHandle associated with a method whichreturns the type value. The type value may not necessarily be known atthe time the information referencing the variable is generated.

In an embodiment, a compiler generates the above-described informationin a code compilation process. The compiler may store the informationwithin the same set of bytecode that includes the target virtual machineinstruction. Specifically, the compiler may generate bytecode whichincludes (a) the target virtual machine instruction and (b) theinformation stored external to and in association with the targetvirtual machine instruction. As an example, the information may beincluded within another virtual machine instruction that precedes thetarget virtual machine instruction within the same set of bytecode.

In an embodiment, a runtime environment processes a target virtualmachine instruction, with one or more parameters, based on respectiveparameter types referenced by information stored external to and inassociation with the target virtual machine instruction. As an example,the runtime environment selects a number of bytes to be used, from adata structure, for executing the target virtual machine instructionbased on the parameter types. The runtime environment may processbytecode that includes both (a) virtual machine instructions associatedwith such information (referencing parameter types) and (b) virtualmachine instructions not associated with such information.

The same virtual machine instruction may be processed differently by theruntime environment depending on whether the virtual machine instructionis associated with external information referencing a parameter type.The parameter type, referenced by the information stored external to atarget virtual machine instruction, may override (a) a parameter typereferenced by the target virtual machine instruction itself or (b) aparameter type deduced by the runtime environment based on previouslyexecuted instructions.

One or more embodiments described in this Specification and/or recitedin the claims may not be included in this General Overview section.

2. Architectural Overview

FIG. 1 illustrates an example architecture in which techniques describedherein may be practiced. Software and/or hardware components describedwith relation to the example architecture may be omitted or associatedwith a different set of functionality than described herein. Softwareand/or hardware components, not described herein, may be used within anenvironment in accordance with one or more embodiments. Accordingly, theexample environment should not be constructed as limiting the scope ofany of the claims.

As illustrated in FIG. 1, a computing architecture 100 includes sourcecode files 101 which are compiled by a compiler 102 into class files 103representing the program to be executed. The class files 103 are thenloaded and executed by an execution platform 112, which includes aruntime environment 113, an operating system 111, and one or moreapplication programming interfaces (APIs) 110 that enable communicationbetween the runtime environment 113 and the operating system 111. Theruntime environment 112 includes a virtual machine 104 comprisingvarious components, such as a memory manager 105 (which may include agarbage collector), a class file verifier 106 to check the validity ofclass files 103, a class loader 107 to locate and build in-memoryrepresentations of classes, an interpreter 108 for executing the virtualmachine 104 code, and a just-in-time (JIT) compiler 109 for producingoptimized machine-level code.

In an embodiment, the computing architecture 100 includes source codefiles 101 that contain code that has been written in a particularprogramming language, such as Java, C, C++, C#, Ruby, Perl, and soforth. Thus, the source code files 101 adhere to a particular set ofsyntactic and/or semantic rules for the associated language. Forexample, code written in Java adheres to the Java LanguageSpecification. However, since specifications are updated and revisedover time, the source code files 101 may be associated with a versionnumber indicating the revision of the specification to which the sourcecode files 101 adhere. The exact programming language used to write thesource code files 101 is generally not critical.

In various embodiments, the compiler 102 converts the source code, whichis written according to a specification directed to the convenience ofthe programmer, to either machine or object code, which is executabledirectly by the particular machine environment, or an intermediaterepresentation (“virtual machine code/instructions”), such as bytecode,which is executable by a virtual machine 104 that is capable of runningon top of a variety of particular machine environments. The virtualmachine instructions are executable by the virtual machine 104 in a moredirect and efficient manner than the source code. Converting source codeto virtual machine instructions includes mapping source codefunctionality from the language to virtual machine functionality thatutilizes underlying resources, such as data structures. Often,functionality that is presented in simple terms via source code by theprogrammer is converted into more complex steps that map more directlyto the instruction set supported by the underlying hardware on which thevirtual machine 104 resides.

In general, programs are executed either as a compiled or an interpretedprogram. When a program is compiled, the code is transformed globallyfrom a first language to a second language before execution. Since thework of transforming the code is performed ahead of time; compiled codetends to have excellent run-time performance. In addition, since thetransformation occurs globally before execution, the code can beanalyzed and optimized using techniques such as constant folding, deadcode elimination, inlining, and so forth. However, depending on theprogram being executed, the startup time can be significant. Inaddition, inserting new code would require the program to be takenoffline, re-compiled, and re-executed. For many dynamic languages (suchas Java) which are designed to allow code to be inserted during theprogram's execution, a purely compiled approach may be inappropriate.When a program is interpreted, the code of the program is readline-by-line and converted to machine-level instructions while theprogram is executing. As a result, the program has a short startup time(can begin executing almost immediately), but the run-time performanceis diminished by performing the transformation on the fly. Furthermore,since each instruction is analyzed individually, many optimizations thatrely on a more global analysis of the program cannot be performed.

In some embodiments, the virtual machine 104 includes an interpreter 108and a JIT compiler 109 (or a component implementing aspects of both),and executes programs using a combination of interpreted and compiledtechniques. For example, the virtual machine 104 may initially begin byinterpreting the virtual machine instructions representing the programvia the interpreter 108 while tracking statistics related to programbehavior, such as how often different sections or blocks of code areexecuted by the virtual machine 104. Once a block of code surpass athreshold (is “hot”), the virtual machine 104 invokes the JIT compiler109 to perform an analysis of the block and generate optimizedmachine-level instructions which replaces the “hot” block of code forfuture executions. Since programs tend to spend most time executing asmall portion of overall code, compiling just the “hot” portions of theprogram can provide similar performance to fully compiled code, butwithout the start-up penalty. Furthermore, although the optimizationanalysis is constrained to the “hot” block being replaced, there stillexists far greater optimization potential than converting eachinstruction individually. There are a number of variations on the abovedescribed example, such as tiered compiling.

In order to provide clear examples, the source code files 101 have beenillustrated as the “top level” representation of the program to beexecuted by the execution platform 111. Although the computingarchitecture 100 depicts the source code files 101 as a “top level”program representation, in other embodiments the source code files 101may be an intermediate representation received via a “higher level”compiler that processed code files in a different language into thelanguage of the source code files 101. Some examples in the followingdisclosure assume that the source code files 101 adhere to a class-basedobject-oriented programming language. However, this is not a requirementto utilizing the features described herein.

In an embodiment, compiler 102 receives as input the source code files101 and converts the source code files 101 into class files 103 that arein a format expected by the virtual machine 104. For example, in thecontext of the JVM, the Java Virtual Machine Specification defines aparticular class file format to which the class files 103 are expectedto adhere. In some embodiments, the class files 103 contain the virtualmachine instructions that have been converted from the source code files101. However, in other embodiments, the class files 103 may containother structures as well, such as tables identifying constant valuesand/or metadata related to various structures (classes, fields, methods,and so forth).

The following discussion assumes that each of the class files 103represents a respective “class” defined in the source code files 101 (ordynamically generated by the compiler 102/virtual machine 104). However,the aforementioned assumption is not a strict requirement and willdepend on the implementation of the virtual machine 104. Thus, thetechniques described herein may still be performed regardless of theexact format of the class files 103. In some embodiments, the classfiles 103 are divided into one or more “libraries” or “packages”, eachof which includes a collection of classes that provide relatedfunctionality. For example, a library may contain one or more classfiles that implement input/output (1/0) operations, mathematics tools,cryptographic techniques, graphics utilities, and so forth. Further,some classes (or fields/methods within those classes) may include accessrestrictions that limit their use to within a particularclass/library/package or to classes with appropriate permissions.

2.1 Example Class File Structure

FIG. 2 illustrates an example structure for a class file 200 in blockdiagram form according to an embodiment. In order to provide clearexamples, the remainder of the disclosure assumes that the class files103 of the computing architecture 100 adhere to the structure of theexample class file 200 described in this section. However, in apractical environment, the structure of the class file 200 will bedependent on the implementation of the virtual machine 104. Further, oneor more features discussed herein may modify the structure of the classfile 200 to, for example, add additional structure types. Therefore, theexact structure of the class file 200 is not critical to the techniquesdescribed herein. For the purposes of Section 2.1, “the class” or “thepresent class” refers to the class represented by the class file 200.

In FIG. 2, the class file 200 includes a constant table 201, fieldstructures 208, class metadata 204, and method structures 209. In anembodiment, the constant table 201 is a data structure which, amongother functions, acts as a symbol table for the class. For example, theconstant table 201 may store data related to the various identifiersused in the source code files 101 such as type, scope, contents, and/orlocation. The constant table 201 has entries for value structures 202(representing constant values of type int, long, double, float, byte,string, and so forth), class information structures 203, name and typeinformation structures 205, field reference structures 206, and methodreference structures 207 derived from the source code files 101 by thecompiler 102. In an embodiment, the constant table 201 is implemented asan array that maps an index i to structure j. However, the exactimplementation of the constant table 201 is not critical.

In some embodiments, the entries of the constant table 201 includestructures which index other constant table 201 entries. For example, anentry for one of the value structures 202 representing a string may holda tag identifying its “type” as string and an index to one or more othervalue structures 202 of the constant table 201 storing char, byte or intvalues representing the ASCII characters of the string.

In an embodiment, field reference structures 206 of the constant table201 hold an index into the constant table 201 to one of the classinformation structures 203 representing the class defining the field andan index into the constant table 201 to one of the name and typeinformation structures 205 that provides the name and descriptor of thefield. Method reference structures 207 of the constant table 201 hold anindex into the constant table 201 to one of the class informationstructures 203 representing the class defining the method and an indexinto the constant table 201 to one of the name and type informationstructures 205 that provides the name and descriptor for the method. Theclass information structures 203 hold an index into the constant table201 to one of the value structures 202 holding the name of theassociated class.

The name and type information structures 205 hold an index into theconstant table 201 to one of the value structures 202 storing the nameof the field/method and an index into the constant table 201 to one ofthe value structures 202 storing the descriptor.

In an embodiment, class metadata 204 includes metadata for the class,such as version number(s), number of entries in the constant pool,number of fields, number of methods, access flags (whether the class ispublic, private, final, abstract, etc.), an index to one of the classinformation structures 203 of the constant table 201 that identifies thepresent class, an index to one of the class information structures 203of the constant table 201 that identifies the superclass (if any), andso forth.

In an embodiment, the field structures 208 represent a set of structuresthat identifies the various fields of the class. The field structures208 store, for each field of the class, accessor flags for the field(whether the field is static, public, private, final, etc.), an indexinto the constant table 201 to one of the value structures 202 thatholds the name of the field, and an index into the constant table 201 toone of the value structures 202 that holds a descriptor of the field.

In an embodiment, the method structures 209 represent a set ofstructures that identifies the various methods of the class. The methodstructures 209 store, for each method of the class, accessor flags forthe method (e.g. whether the method is static, public, private,synchronized, etc.), an index into the constant table 201 to one of thevalue structures 202 that holds the name of the method, an index intothe constant table 201 to one of the value structures 202 that holds thedescriptor of the method, and the virtual machine instructions thatcorrespond to the body of the method as defined in the source code files101.

In an embodiment, a descriptor represents a type of a field or method.For example, the descriptor may be implemented as a string adhering to aparticular syntax. While the exact syntax is not critical, a fewexamples are described below.

In an example where the descriptor represents a type of the field, thedescriptor identifies the type of data held by the field. In anembodiment, a field can hold a basic type, an object, or an array. Whena field holds a basic type, the descriptor is a string that identifiesthe basic type (e.g., “B”=byte, “C”=char, “D”=double, “F”=float,“I”=int, “J”=long int, etc.). When a field holds an object, thedescriptor is a string that identifies the class name of the object(e.g. “L ClassName”). “L” in this case indicates a reference, thus “LClassName” represents a reference to an object of class ClassName. Whenthe field is an array, the descriptor identifies the type held by thearray. For example, “[B” indicates an array of bytes, with “[”indicating an array and “B” indicating that the array holds the basictype of byte. However, since arrays can be nested, the descriptor for anarray may also indicate the nesting. For example, “[[L ClassName”indicates an array where each index holds an array that holds objects ofclass ClassName. In some embodiments, the ClassName is fully qualifiedand includes the simple name of the class, as well as the pathname ofthe class. For example, the ClassName may indicate where the file isstored in the package, library, or file system hosting the class file200.

In the case of a method, the descriptor identifies the parameters of themethod and the return type of the method. For example, a methoddescriptor may follow the general form “(

{ParameterDescriptor}) ReturnDescriptor”, where the{ParameterDescriptor} is a list of field descriptors representing theparameters and the ReturnDescriptor is a field descriptor identifyingthe return type. For instance, the string “V” may be used to representthe void return type. Thus, a method defined in the source code files101 as “Object m(int I, double d, Thread t) {. . . }” matches thedescriptor “(I D L Thread) L Object”.

In an embodiment, the virtual machine instructions held in the methodstructures 209 include operations which reference entries of theconstant table 201. Using Java as an example, consider the followingclass:

class A { int add12and13( ) { return B.addTwo(12, 13); } }

In the above example, the Java method add12 and 13 is defined in classA, takes no parameters, and returns an integer. The body of method add12and 13 calls static method addTwo of class B which takes the constantinteger values 12 and 13 as parameters, and returns the result. Thus, inthe constant table 201, the compiler 102 includes, among other entries,a method reference structure that corresponds to the call to the methodB.addTwo. In Java, a call to a method compiles down to an invoke commandin the bytecode of the JVM (in this case invokestatic as addTwo is astatic method of class B). The invoke command is provided an index intothe constant table 201 corresponding to the method reference structurethat identifies the class defining addTwo “B”, the name of addTwo“addTwo”, and the descriptor of addTwo “(I I)I”. For example, assumingthe aforementioned method reference is stored at index 4, the bytecodeinstruction may appear as “invokestatic #4”.

Since the constant table 201 refers to classes, methods, and fieldssymbolically with structures carrying identifying information, ratherthan direct references to a memory location, the entries of the constanttable 201 are referred to as “symbolic references”. One reason thatsymbolic references are utilized for the class files 103 is because, insome embodiments, the compiler 102 is unaware of how and where theclasses will be stored once loaded into the runtime environment 112. Aswill be described in Section 2.3, eventually the run-time representationof the symbolic references are resolved into actual memory addresses bythe virtual machine 104 after the referenced classes (and associatedstructures) have been loaded into the runtime environment and allocatedconcrete memory locations.

2.2 Example Virtual Machine Architecture

FIG. 3 illustrates an example virtual machine memory layout 300 in blockdiagram form according to an embodiment. In order to provide clearexamples, the remaining discussion will assume that the virtual machine104 adheres to the virtual machine memory layout 300 depicted in FIG. 3.In addition, although components of the virtual machine memory layout300 may be referred to as memory “areas”, there is no requirement thatthe memory areas are contiguous.

In the example illustrated by FIG. 3, the virtual machine memory layout300 is divided into a shared area 301 and a thread area 307. The sharedarea 301 represents an area in memory where structures shared among thevarious threads executing on the virtual machine 104 are stored. Theshared area 301 includes a heap 302 and a per-class area 303. In anembodiment, the heap 302 represents the run-time data area from whichmemory for class instances and arrays is allocated. In an embodiment,the per-class area 303 represents the memory area where the datapertaining to the individual classes are stored. In an embodiment, theper-class area 303 includes, for each loaded class, a run-time constantpool 304 representing data from the constant table 201 of the class,field and method data 306 (for example, to hold the static fields of theclass), and the method code 305 representing the virtual machineinstructions for methods of the class.

The thread area 307 represents a memory area where structures specificto individual threads are stored. In FIG. 3, the thread area 307includes thread structures 308 and thread structures 311, representingthe per-thread structures utilized by different threads. In order toprovide clear examples, the thread area 307 depicted in FIG. 3 assumestwo threads are executing on the virtual machine 104. However, in apractical environment, the virtual machine 104 may execute any arbitrarynumber of threads, with the number of thread structures scaledaccordingly.

In an embodiment, thread structures 308 includes program counter 309 andvirtual machine stack 310. Similarly, thread structures 311 includesprogram counter 312 and virtual machine stack 313. In an embodiment,program counter 309 and program counter 312 store the current address ofthe virtual machine instruction being executed by their respectivethreads.

Thus, as a thread steps through the instructions, the program countersare updated to maintain an index to the current instruction. In anembodiment, virtual machine stack 310 and virtual machine stack 313 eachstore frames for their respective threads that hold local variables andpartial results, and is also used for method invocation and return.

In an embodiment, a frame is a data structure used to store data andpartial results, return values for methods, and perform dynamic linking.A new frame is created each time a method is invoked. A frame isdestroyed when the method that caused the frame to be generatedcompletes. Thus, when a thread performs a method invocation, the virtualmachine 104 generates a new frame and pushes that frame onto the virtualmachine stack associated with the thread.

When the method invocation completes, the virtual machine 104 passesback the result of the method invocation to the previous frame and popsthe current frame off of the stack. In an embodiment, for a giventhread, one frame is active at any point. This active frame is referredto as the current frame, the method that caused generation of thecurrent frame is referred to as the current method, and the class towhich the current method belongs is referred to as the current class.

FIG. 4 illustrates an example frame 400 in block diagram form accordingto an embodiment. In order to provide clear examples, the remainingdiscussion will assume that frames of virtual machine stack 310 andvirtual machine stack 313 adhere to the structure of frame 400.

In an embodiment, frame 400 includes local variables 401, operand stack402, and run-time constant pool reference table 403. In an embodiment,the local variables 401 are represented as an array of variables thateach hold a value, for example, Boolean, byte, char, short, int, float,or reference. Further, some value types, such as longs or doubles, maybe represented by more than one entry in the array. The local variables401 are used to pass parameters on method invocations and store partialresults. For example, when generating the frame 400 in response toinvoking a method, the parameters may be stored in predefined positionswithin the local variables 401, such as indexes 1-N corresponding to thefirst to Nth parameters in the invocation.

In an embodiment, the operand stack 402 is empty by default when theframe 400 is created by the virtual machine 104. The virtual machine 104then supplies instructions from the method code 305 of the currentmethod to load constants or values from the local variables 501 onto theoperand stack 502. Other instructions take operands from the operandstack 402, operate on them, and push the result back onto the operandstack 402. Furthermore, the operand stack 402 is used to prepareparameters to be passed to methods and to receive method results. Forexample, the parameters of the method being invoked could be pushed ontothe operand stack 402 prior to issuing the invocation to the method. Thevirtual machine 104 then generates a new frame for the method invocationwhere the operands on the operand stack 402 of the previous frame arepopped and loaded into the local variables 401 of the new frame. Whenthe invoked method terminates, the new frame is popped from the virtualmachine stack and the return value is pushed onto the operand stack 402of the previous frame.

In an embodiment, the run-time constant pool reference table 403contains a reference to the run-time constant pool 304 of the currentclass. The run-time constant pool reference table 403 is used to supportresolution. Resolution is the process whereby symbolic references in theconstant pool 304 are translated into concrete memory addresses, loadingclasses as necessary to resolve as-yet-undefined symbols and translatingvariable accesses into appropriate offsets into storage structuresassociated with the run-time location of these variables.

2.3 Loading, Linking, and Initializing

In an embodiment, the virtual machine 104 dynamically loads, links, andinitializes classes. Loading is the process of finding a class with aparticular name and creating a representation from the associated classfile 200 of that class within the memory of the runtime environment 112.For example, creating the run-time constant pool 304, method code 305,and field and method data 306 for the class within the per-class area303 of the virtual machine memory layout 300. Linking is the process oftaking the in-memory representation of the class and combining it withthe run-time state of the virtual machine 104 so that the methods of theclass can be executed. Initialization is the process of executing theclass constructors to set the starting state of the field and methoddata 306 of the class and/or create class instances on the heap 302 forthe initialized class.

The following are examples of loading, linking, and initializingtechniques that may be implemented by the virtual machine 104. However,in many embodiments the steps may be interleaved, such that an initialclass is loaded, then during linking a second class is loaded to resolvea symbolic reference found in the first class, which in turn causes athird class to be loaded, and so forth. Thus, progress through thestages of loading, linking, and initializing can differ from class toclass. Further, some embodiments may delay (perform “lazily”) one ormore functions of the loading, linking, and initializing process untilthe class is actually required. For example, resolution of a methodreference may be delayed until a virtual machine instruction invokingthe method is executed. Thus, the exact timing of when the steps areperformed for each class can vary greatly between implementations.

To begin the loading process, the virtual machine 104 starts up byinvoking the class loader 107 which loads an initial class. Thetechnique by which the initial class is specified will vary fromembodiment to embodiment. For example, one technique may have thevirtual machine 104 accept a command line argument on startup thatspecifies the initial class.

To load a class, the class loader 107 parses the class file 200corresponding to the class and determines whether the class file 200 iswell-formed (meets the syntactic expectations of the virtual machine104). If not, the class loader 107 generates an error. For example, inJava the error might be generated in the form of an exception which isthrown to an exception handler for processing. Otherwise, the classloader 107 generates the in-memory representation of the class byallocating the run-time constant pool 304, method code 305, and fieldand method data 306 for the class within the per-class area 303.

In some embodiments, when the class loader 107 loads a class, the classloader 107 also recursively loads the super-classes of the loaded class.For example, the virtual machine 104 may ensure that the superclasses ofa particular class are loaded, linked, and/or initialized beforeproceeding with the loading, linking and initializing process for theparticular class.

During linking, the virtual machine 104 verifies the class, prepares theclass, and performs resolution of the symbolic references defined in therun-time constant pool 304 of the class.

To verify the class, the virtual machine 104 checks whether thein-memory representation of the class is structurally correct. Forexample, the virtual machine 104 may check that each class except thegeneric class Object has a superclass, check that final classes have nosub-classes and final methods are not overridden, check whether constantpool entries are consistent with one another, check whether the currentclass has correct access permissions for classes/fields/structuresreferenced in the constant pool 304, check that the virtual machine 104code of methods will not cause unexpected behavior (e.g. making sure ajump instruction does not send the virtual machine 104 beyond the end ofthe method), and so forth. The exact checks performed duringverification are dependent on the implementation of the virtual machine104. In some cases, verification may cause additional classes to beloaded, but does not necessarily require those classes to also be linkedbefore proceeding. For example, assume Class A contains a reference to astatic field of Class B. During verification, the virtual machine 104may check Class B to ensure that the referenced static field actuallyexists, which might cause loading of Class B, but not necessarily thelinking or initializing of Class B. However, in some embodiments,certain verification checks can be delayed until a later phase, such asbeing checked during resolution of the symbolic references. For example,some embodiments may delay checking the access permissions for symbolicreferences until those references are being resolved.

To prepare a class, the virtual machine 104 initializes static fieldslocated within the field and method data 306 for the class to defaultvalues. In some cases, setting the static fields to default values maynot be the same as running a constructor for the class. For example, theverification process may zero out or set the static fields to valuesthat the constructor would expect those fields to have duringinitialization.

During resolution, the virtual machine 104 dynamically determinesconcrete memory address from the symbolic references included in therun-time constant pool 304 of the class. To resolve the symbolicreferences, the virtual machine 104 utilizes the class loader 107 toload the class identified in the symbolic reference (if not alreadyloaded). Once loaded, the virtual machine 104 has knowledge of thememory location within the per-class area 303 of the referenced classand its fields/methods. The virtual machine 104 then replaces thesymbolic references with a reference to the concrete memory location ofthe referenced class, field, or method. In an embodiment, the virtualmachine 104 caches resolutions to be reused in case the sameclass/name/descriptor is encountered when the virtual machine 104processes another class. For example, in some cases, class A and class Bmay invoke the same method of class C. Thus, when resolution isperformed for class A, that result can be cached and reused duringresolution of the same symbolic reference in class B to reduce overhead.

In some embodiments, the step of resolving the symbolic referencesduring linking is optional. For example, an embodiment may perform thesymbolic resolution in a “lazy” fashion, delaying the step of resolutionuntil a virtual machine instruction that requires the referencedclass/method/field is executed.

During initialization, the virtual machine 104 executes the constructorof the class to set the starting state of that class. For example,initialization may initialize the field and method data 306 for theclass and generate/initialize any class instances on the heap 302created by the constructor. For example, the class file 200 for a classmay specify that a particular method is a constructor that is used forsetting up the starting state. Thus, during initialization, the virtualmachine 104 executes the instructions of that constructor.

In some embodiments, the virtual machine 104 performs resolution onfield and method references by initially checking whether thefield/method is defined in the referenced class. Otherwise, the virtualmachine 104 recursively searches through the super-classes of thereferenced class for the referenced field/method until the field/methodis located, or the top-level superclass is reached, in which case anerror is generated.

3. Extending A Virtual Machine Instruction Set Architecture

As noted above, a compiler may convert source code to bytecode includingvirtual machine instructions which are executable by a virtual machine.One or more embodiments are applicable to a particular virtual machineinstruction which may operate on different types of parameters. Examplesof virtual machine instructions, supported by the Java Virtual Machine,that may operate on different types of parameters include, but are notlimited to: aload, astore, areturn, aaload, aastore, anewarray,multianewarray, and checkcast.

The different types of parameters include parameters of primitive typesand parameters of reference types. Primitive types include byte, short,int, long, float, double, char, String, object, boolean, andreturnAddress. Reference types include class types, array types, andinterface types.

A parameter type may correspond to or comprise semantics associated witha virtual machine instruction. In one example, the parameter type may beused in relation to “value types.” Value types may representuser-defined aggregate types without identity that can be surfaced inthe language of the source code files and the instruction set of thevirtual machine to support memory- and locality-efficient programmingidioms without sacrificing encapsulation.

In an embodiment, value types are heterogeneous aggregates that cancontain primitive types, reference types, or even other value types. Insome embodiments, many of the definitions and encapsulation machineryused for classes, for example in Java, can be used to easily and safelybuild a new value type construct based data structures. For example,value types can be treated as a form of specially marked and restrictedclass definitions. Value types function, from a semantic perspective, asa new kind of primitive type to users of the virtual machine. A detaileddescription of “value types” is included herewith in Appendix C.

3.1 Referencing Parameter Types for Virtual Machine Instructions

FIG. 5 illustrates an example of bytecode (e.g., bytecode 502) whichincludes any number of virtual machine instructions. Each virtualmachine instruction includes any number of parameters. For purposes ofclarity, virtual machine instruction 506 and parameter 508 areillustrated in FIG. 5 and described below. Information 504 maycorrespond to another virtual machine instruction that is associatedwith virtual machine instruction 506, as detailed below.

In an embodiment, the compiler generates and stores information (e.g.,information 504) that references a parameter type 510 for the parameter508 of virtual machine instruction 506. The compiler stores theinformation 504 within the same set of bytecode 502 as the virtualmachine instruction 506. The compiler stores the information 504external to and in association with the virtual machine instruction 506.A virtual machine processes the virtual machine instruction 506 based onthe parameter type 510, as described below with reference to FIG. 6.Parameter 510 overrides other parameter types (e.g., parameter type 512)which are referenced by the virtual machine instruction 506 itself orwhich can be deduced by the virtual machine based on previously executedvirtual machine instructions (described in detail below with referenceto FIG. 6).

In an embodiment, the association between the information 504 and thevirtual machine instruction 506 may be indicated by a compiler (andlater identified by the virtual machine) based at least on an adjacencyand/or location of the information 504 with respect to the virtualmachine instruction 506. As an example, information stored external toand immediately preceding the virtual machine instruction 506 may bedetermined to be associated with the virtual machine instruction 506. Inanother implementation, information stored external to and immediatelyfollowing the virtual machine instruction 506 may be determined to beassociated with the virtual machine instruction 506.

In an embodiment, information 504 references the parameter type 510 byreferencing a variable corresponding to the parameter type 510. Thevalue of the variable (i.e., the parameter type 510) may be stored at aparticular location of a constant table. Alternatively or in addition,the particular location of the constant table may be designated forstoring the value of the variable. The value of the variable may or maynot be known when the information 504, referencing the variable, is (a)generated and (b) stored in association with and external to the virtualmachine instruction 506.

In an embodiment, the information 504 references parameter type 510 byreferencing a variable corresponding to a method handle (see classMethodHandle in Java API). The method handle is a typed, directlyexecutable reference to an underlying method that returns parameter type510.

In an example, information 504 includes a meta-data reference to aconstant pool indicating the parameter type 510 of the parameter 508 ofvirtual machine instruction 506. The meta-data reference may be, forexample, a 16-bit reference into the constant pool of the classcorresponding to the virtual machine instruction 506. The referencedconstant pool entry can be any kind of an entry that describes a type.

In an embodiment, information 504 is implemented as a second virtualmachine instruction that is stored adjacent to (e.g., immediatelypreceding) the virtual machine instruction 506. The second virtualmachine instruction includes a parameter that references the parametertype 510 of parameter 508 of the virtual machine instruction 506. Theparameter of the second virtual machine instruction may reference avariable corresponding to the parameter type 510 for parameter 508 ofvirtual machine instruction 506. The parameter of the second virtualmachine instruction may include a meta-data reference to a constant poolindicating parameter type 510 for parameter 508 of virtual machineinstruction 506.

In an embodiment, a special keyword may be used to signal a reference toparameter type 510 for parameter 508 of virtual machine instruction 506.As an example, the information 504 corresponds to a second virtualmachine instruction that includes a particular keyword, “typed”. Theparticular keyword signals, to a runtime environment, that the secondvirtual machine includes information referencing parameter type 510 forparameter 508 of virtual machine instruction 506.

As an example, the virtual machine instruction 506 (referred to as“opcode”) is preceded by type information in one of the followingexample formats:

FORMAT 1: FORMAT 2: typed typed indexbyte1 indexbyte1 indextype2indextype2 <opcode> <opcode> <opcode-operands>

In the above example formats, “typed” is a keyword signaling typeinformation follows for the <opcode>. In FORMAT 1, the parameters forthe <opcode>, i.e., the parameters upon which the opcode is operated arestored as local variables. Examples of <opcode>, i.e., the instructionused with FORMAT 1 include, but are not limited to aload 0,1,2,3, astore0,1,2,3, dup, dup_x1, dup_x2, dup2, dup2_x1, dup2_x2, areturn, aaload,aastore, and cmp eq. In FORMAT 2, the parameters for the <opcode>, i.e.,the parameters upon which the opcode is operated follow the <opcode>.Examples of <opcode>, i.e., the instruction used with FORMAT 2 include,but are not limited to aload, astore, anewarray, multianewarray, andcheckcast.

3.2 Processing Virtual Machine Instructions Based on ExternallyReferenced Parameter Types

FIG. 6 illustrates an example set of operations for processing virtualmachine instructions with at least one parameter in accordance with oneor more embodiments. A virtual machine instruction may, for example,operate on a parameter that is stored in a data structure (e.g., a stackmaintained by a virtual machine). For example, the result of executing avirtual machine instruction is stored in a stack. The next-executedvirtual machine instruction operates on a parameter corresponding to thelast stored value (result from previously executed virtual machineinstruction) in the stack. A virtual machine instruction may specify aparameter following an opcode.

Operations described below with reference to FIG. 6 may be rearranged,omitted, or modified. Additional operations, not described below, may beperformed instead of or in addition to the described operations.Accordingly, the operations as recited below should not be construed tolimit the scope of any of the claims recited herein.

One or more embodiments include determining whether a virtual machineinstruction, operating on at least one parameter, is stored inassociation with external information referencing a respective parametertype (Operation 602).

A virtual machine processing the virtual machine instruction may beconfigured to detect information, external to the virtual machineinstruction, which references a parameter type of a parameter of thevirtual machine instruction. As described above, such information may bestored within a same set of bytecode as the virtual machine instruction.Furthermore, such information may be stored in association with thevirtual machine instruction.

In an embodiment, a virtual machine detects information referencingparameter types based on the information matching a defined set ofcriteria. The criteria may require, for example, (a) a location of theinformation with respect to the virtual machine instruction, or (b) aparticular keyword. As an example, a compiler stores the information,referencing parameter types for parameters of a first virtual machineinstruction, in a second virtual machine instruction that (a)immediately precedes the first virtual machine instruction and (b)includes a particular keyword, “typed”. The virtual machine (or runtimeenvironment) is configured to determine that a virtual machineinstruction that includes “typed” corresponds to information referencingparameter types of parameters of the immediately subsequent virtualmachine instruction. In other examples, a compiler may include theinformation, referencing parameter types of parameters of a virtualmachine instruction, in other formats recognized by the virtual machine.

If external information, referencing parameter types for parameters of avirtual machine instruction, is detected, then the virtual machineprocesses the virtual machine instruction based on the parameter typesreferenced by the external information (Operation 604). This virtualmachine instruction (to be processed based on the parameter typesreferenced by the external information) may be a complete and fullyexecutable instruction independent of (and even in the absence of) theparameter types referenced by the external information. The informationstored external to and in association with the first virtual machineinstruction refines, tailors, or specializes operation of the firstvirtual machine instruction for a more specific purpose as indicated bythe external information. In the absence of the external information,the first virtual machine instruction may still execute using a set oftypes that are applicable to a variety of purposes including thespecific purpose.

In order to process the virtual machine instruction based on theparameter types referenced by the external information, the parametertypes must first be determined. The information may reference a memorylocation and/or a variable which is accessed to determine thecorresponding parameter types. The information may reference aMethodHandle associated with a method which is executed to return theparameter types.

Processing the virtual machine instruction based on the parameter typereferenced by the external information includes executing an action thatis selected based on the parameter type. As an example, a number ofbytes to be processed from a data structure (e.g., a stack) may beselected based on a parameter type referenced by the externalinformation. The bytes may be used for a data movement operation, a datacomparison operation, or a data retrieval operation. As other examples,the parameter type, referenced by the external information, may be usedfor type casting, generic method calls, or any other kind of operation.

The parameter types referenced by the external information overrideother parameter types that may be identified by the virtual machine. Theparameter types, referenced by the information stored external to and inassociation with the virtual machine instruction, override parametertypes referenced by the virtual machine instruction itself. Theparameter types, referenced by the information stored external to and inassociation with the virtual machine instruction, override otherparameter types that may be deduced by the virtual machine based onpreviously executed instructions. The parameter types, referenced by theinformation stored external to and in association with the virtualmachine instruction, override parameter types stored with parametervalues within a data structure (e.g., stack) maintained by the virtualmachine.

Multiple different techniques may be implemented for overridingparameter types. In one example, illustrated in FIG. 6, the otherparameter types that may be determined by a virtual machine are neveridentified. Specifically, when information that is (a) stored externalto and in association with a virtual machine instruction and (b)references parameter types is detected, operations 608-610 which relateto the other parameter types are omitted.

In other examples, the other parameter types (e.g., deduced by thevirtual machine based on previously executed instructions, or referencedby the target virtual machine instruction itself) are first determined.Thereafter, if information that is (a) stored external to and inassociation with a virtual machine instruction and (b) referencesparameter types is detected, the over parameter types arediscarded/explicitly overridden.

Returning to FIG. 6, if the external information referencing parametertypes is not detected in operation 602, then the virtual machine mayprocess the virtual machine instruction based on any parameter typesthat are deduced by the virtual machine based on previously executedinstructions, or referenced by the target virtual machine instructionitself (Operations 608-610). As an example, a previously executedvirtual machine instruction adds two integers and stores the value in astack. The next-executed instruction operates on the last stored valueas a parameter. The last-stored value in the stack is known to be aninteger because it was generated by adding two integers. The parametertype integer may thus be deduced by the virtual machine. Furthermore,the parameter type integer may be stored in the stack in associationwith the last-stored value.

If no parameter type information is identified for a virtual machineinstruction, then an error may be generated or a base type may be usedas the parameter type for processing the virtual machine instruction(Operation 612). Generating an error or using a base type may depend onthe virtual machine instruction, the configuration of the virtualmachine, or any other factor. As an example, an “object” type may beused as a parameter type for processing a virtual machine instructionwith parameters without any associated parameter types.

3.3 Example uses of Referenced Parameter Types

Information referencing the type of the parameter(s) of virtual machineinstructions may or may not be included for different virtual machineinstructions. Embodiments herein relate to the generation and use ofbytecode with one or both of:

-   -   (a) Virtual machine instructions stored in association with        information (external to the virtual machine instructions) that        reference the parameter types of the parameters of the virtual        machine instructions (see operation 604).    -   (b) Virtual machine instructions stored without information        (external to the virtual machine instructions) that reference        the parameter types of the parameters of the virtual machine        instructions (see operations 608-612).

In an embodiment, a decision to include the information referencingparameter types for any virtual machine instruction may depend on anynumber of factors. The factors include, but are not limited to, theactual type of the parameters of the virtual machine instruction,whether enhanced versatility is needed for the virtual machineinstruction (e.g., in view of platform evolution), and whether specificsemantics need to be signaled/are applicable (e.g., for new types).

The use of information referencing parameter types for virtual machineinstructions may help avoid the need for extra value-type information.The use of preceding information referencing types for instructionparameters may provide an enhanced means for communicating the parametertypes with an execution engine.

Generic Specialization: In one example, which should not be construed aslimiting the scope of any of the claims, bytecode for generic classesand methods are generated such that information referencing parametertypes are used when a virtual machine instruction operates on values ofgeneric types. Specializing the generic class or method includesspecializing the meta-data, associated with the parameter types of theparameters of virtual machine instructions, to include the correct type.In this manner, virtual machine instructions pertaining to generic typespecializations will be strongly typed.

Adding Types: In an embodiment, referencing parameter types allows forextending the semantics of instructions. The parameter types providecontext to a particular virtual machine instruction and may be used tomap to a particular set of semantics of all sets of semantics that maybe applicable to the particular virtual machine instruction. Newsemantics for value types (elements of which may consume more than oneor more machine words that are usually found in Java types) can berepresented by referencing parameter types, in a constant pool, forinstructions that handle value type elements.

Dynamic Language Implementation: Dynamic language implementations thattarget a VM platform ISA by compiling source language functions can useparameter types to generate bytecode that is highly specific with regardto the occurring types.

As noted above, one or more embodiments are applicable to identifyingtypes that are value types. In one example, value types have to besupported by a generic type system. A flexible generic specializationapproach, as described above, may be helpful. Specializing a generictype includes patching the constant pool entries referenced by theinformation preceding virtual machine instructions.

In one example, inlining is an optimization that replaces method callsby substituting the call with the body of the called method. As aresult, the virtual machine is able to omit jump instructions, whichtend to be fairly costly. Furthermore, inlining can be performedrecursively (“deep inlining”), thus if Method A calls Method B which intum calls Method C, the contents of both Method B and Method C can beinlined into Method A. However, when a method invocation is potentiallypolymorphic, such as the JVM invokevirtual instruction, the virtualmachine may not know for sure which implementation of the method will becalled during run-time and thus should be inlined.

For example, consider an abstract class Feline which has a sub-classHouseCat and another sub-class Lion. HouseCat implements the methodspeak, by printing “meow” and Lion implements the method speak byprinting “roar”. Assume Method C takes a parameter object of type Felineand invokes the speak method of that object. Method C is called by bothMethod A and Method B, where Method A passes a parameter of typeHouseCat to Method C and Method B passes a parameter of type Lion toMethod C. In this example, if the virtual machine attempted to perform adeep inlining of Method C into Method A, the type information for thespeak invocation in Method C would indicate that both type Lion and typeHouseCat have been seen as the receiver at that point in the program(assuming both Method A and Method B have been executed at least once).As a result, the virtual machine would be unable to resolve whichimplementation of speak to inline into Method C and ultimately intoMethod A.

To resolve such issues, embodiments rely upon the types of theparameters of an invocation. The virtual machine accesses parameter type(referenced by information preceding the invocation) for parameters ofthe invocation from Method A to Method C that indicates the type of thepassed parameter is HouseCat. As a result, rather than optimizing basedon the assumption the parameter is of declared type Feline and beingunable to resolve the receiver due to the polluted profile, theinformation related to the type of the passed parameter allows thevirtual machine to determine that, when called from Method A, thereceiver of the speak invocation is the more specific type HouseCat.Thus, parameter type flows from caller to callee based on theinformation referencing to parameter types. Once the more specific typehas been resolved, the virtual machine is able to determine whichimplementation of speak to inline during the compiling and optimizationprocess.

4. Miscellaneous; Extensions

Embodiments are directed to a system with one or more devices thatinclude a hardware processor and that are configured to perform any ofthe operations described herein and/or recited in any of the claimsbelow.

In an embodiment, a non-transitory computer readable storage mediumcomprises instructions which, when executed by one or more hardwareprocessors, causes performance of any of the operations described hereinand/or recited in any of the claims.

Any combination of the features and functionalities described herein maybe used in accordance with one or more embodiments. In the foregoingspecification, embodiments have been described with reference tonumerous specific details that may vary from implementation toimplementation. The specification and drawings are, accordingly, to beregarded in an illustrative rather than a restrictive sense. The soleand exclusive indicator of the scope of the invention, and what isintended by the applicants to be the scope of the invention, is theliteral and equivalent scope of the set of claims that issue from thisapplication, in the specific form in which such claims issue, includingany subsequent correction.

5. Hardware Overview

According to one embodiment, the techniques described herein areimplemented by one or more special-purpose computing devices. Thespecial-purpose computing devices may be hard-wired to perform thetechniques, or may include digital electronic devices such as one ormore application-specific integrated circuits (ASICs) or fieldprogrammable gate arrays (FPGAs) that are persistently programmed toperform the techniques, or may include one or more general purposehardware processors programmed to perform the techniques pursuant toprogram instructions in firmware, memory, other storage, or acombination. Such special-purpose computing devices may also combinecustom hard-wired logic, ASICs, or FPGAs with custom programming toaccomplish the techniques. The special-purpose computing devices may bedesktop computer systems, portable computer systems, handheld devices,networking devices or any other device that incorporates hard-wiredand/or program logic to implement the techniques.

For example, FIG. 7 is a block diagram that illustrates a computersystem 700 upon which an embodiment of the invention may be implemented.Computer system 700 includes a bus 702 or other communication mechanismfor communicating information, and a hardware processor 704 coupled withbus 702 for processing information. Hardware processor 704 may be, forexample, a general purpose microprocessor.

Computer system 700 also includes a main memory 706, such as a randomaccess memory (RAM) or other dynamic storage device, coupled to bus 702for storing information and instructions to be executed by processor704. Main memory 706 also may be used for storing temporary variables orother intermediate information during execution of instructions to beexecuted by processor 704. Such instructions, when stored innon-transitory storage media accessible to processor 704, rendercomputer system 700 into a special-purpose machine that is customized toperform the operations specified in the instructions.

Computer system 700 further includes a read only memory (ROM) 708 orother static storage device coupled to bus 702 for storing staticinformation and instructions for processor 704. A storage device 710,such as a magnetic disk or optical disk, is provided and coupled to bus702 for storing information and instructions.

Computer system 700 may be coupled via bus 702 to a display 712, such asa cathode ray tube (CRT), for displaying information to a computer user.An input device 714, including alphanumeric and other keys, is coupledto bus 702 for communicating information and command selections toprocessor 704. Another type of user input device is cursor control 716,such as a mouse, a trackball, or cursor direction keys for communicatingdirection information and command selections to processor 704 and forcontrolling cursor movement on display 712. This input device typicallyhas two degrees of freedom in two axes, a first axis (e.g., x) and asecond axis (e.g., y), that allows the device to specify positions in aplane.

Computer system 700 may implement the techniques described herein usingcustomized hard-wired logic, one or more ASICs or FPGAs, firmware and/orprogram logic which in combination with the computer system causes orprograms computer system 700 to be a special-purpose machine. Accordingto one embodiment, the techniques herein are performed by computersystem 700 in response to processor 704 executing one or more sequencesof one or more instructions contained in main memory 706. Suchinstructions may be read into main memory 706 from another storagemedium, such as storage device 710. Execution of the sequences ofinstructions contained in main memory 706 causes processor 704 toperform the process steps described herein. In alternative embodiments,hard-wired circuitry may be used in place of or in combination withsoftware instructions.

The term “storage media” as used herein refers to any non-transitorymedia that store data and/or instructions that cause a machine tooperation in a specific fashion. Such storage media may comprisenon-volatile media and/or volatile media. Non-volatile media includes,for example, optical or magnetic disks, such as storage device 710.Volatile media includes dynamic memory, such as main memory 706. Commonforms of storage media include, for example, a floppy disk, a flexibledisk, hard disk, solid state drive, magnetic tape, or any other magneticdata storage medium, a CD-ROM, any other optical data storage medium,any physical medium with patterns of holes, a RAM, a PROM, and EPROM, aFLASH-EPROM, NVRAM, any other memory chip or cartridge.

Storage media is distinct from but may be used in conjunction withtransmission media. Transmission media participates in transferringinformation between storage media. For example, transmission mediaincludes coaxial cables, copper wire and fiber optics, including thewires that comprise bus 702. Transmission media can also take the formof acoustic or light waves, such as those generated during radio-waveand infra-red data communications.

Various forms of media may be involved in carrying one or more sequencesof one or more instructions to processor 704 for execution. For example,the instructions may initially be carried on a magnetic disk or solidstate drive of a remote computer. The remote computer can load theinstructions into its dynamic memory and send the instructions over atelephone line using a modem. A modem local to computer system 700 canreceive the data on the telephone line and use an infra-red transmitterto convert the data to an infra-red signal. An infra-red detector canreceive the data carried in the infra-red signal and appropriatecircuitry can place the data on bus 702. Bus 702 carries the data tomain memory 706, from which processor 704 retrieves and executes theinstructions. The instructions received by main memory 706 mayoptionally be stored on storage device 710 either before or afterexecution by processor 704.

Computer system 700 also includes a communication interface 718 coupledto bus 702. Communication interface 718 provides a two-way datacommunication coupling to a network link 720 that is connected to alocal network 722. For example, communication interface 718 may be anintegrated services digital network (ISDN) card, cable modem, satellitemodem, or a modem to provide a data communication connection to acorresponding type of telephone line. As another example, communicationinterface 718 may be a local area network (LAN) card to provide a datacommunication connection to a compatible LAN. Wireless links may also beimplemented. In any such implementation, communication interface 718sends and receives electrical, electromagnetic or optical signals thatcarry digital data streams representing various types of information.

Network link 720 typically provides data communication through one ormore networks to other data devices. For example, network link 720 mayprovide a connection through local network 722 to a host computer 724 orto data equipment operated by an Internet Service Provider (ISP) 726.ISP 726 in turn provides data communication services through the worldwide packet data communication network now commonly referred to as the“Internet” 728. Local network 722 and Internet 728 both use electrical,electromagnetic or optical signals that carry digital data streams. Thesignals through the various networks and the signals on network link 720and through communication interface 718, which carry the digital data toand from computer system 700, are example forms of transmission media.

Computer system 700 can send messages and receive data, includingprogram code, through the network(s), network link 720 and communicationinterface 718. In the Internet example, a server 730 might transmit arequested code for an application program through Internet 728, ISP 726,local network 722 and communication interface 718.

The received code may be executed by processor 704 as it is received,and/or stored in storage device 710, or other non-volatile storage forlater execution.

In the foregoing specification, embodiments of the invention have beendescribed with reference to numerous specific details that may vary fromimplementation to implementation. The specification and drawings are,accordingly, to be regarded in an illustrative rather than a restrictivesense. The sole and exclusive indicator of the scope of the invention,and what is intended by the applicants to be the scope of the invention,is the literal and equivalent scope of the set of claims that issue fromthis application, in the specific form in which such claims issue,including any subsequent correction.

What is claimed is:
 1. A non-transitory computer readable mediumcomprising instructions which, when executed by one or more hardwareprocessors, cause performance of steps comprising: identifying a firstvirtual machine instruction, within a set of code, that includes aparticular operation; determining whether one or more parameter typesassociated with the first virtual machine instruction is modified by anyset of information that is (a) within the set of code, and (b) externalto the first virtual machine instruction; responsive to determining thatthe one or more parameter types associated with the first virtualmachine instruction is not modified by any set of information that is(a) within the set of code, and (b) external to the first virtualmachine instruction: performing the particular operation based on afirst set of one or more parameter types; identifying a second virtualmachine instruction, within the set of code, that includes theparticular operation; determining whether one or more parameter typesassociated with the second virtual machine instruction is modified byany set of information that is (a) within the set of code, and (b)external to the second virtual machine instruction; responsive todetermining that the one or more parameter types associated with thesecond virtual machine instruction is modified by a particular set ofinformation that is (a) within the set of code, and (b) external to thesecond virtual machine instruction: performing the particular operationbased on a second set of one or more parameter types referenced by theparticular set of information, wherein the first set of one or moreparameter types and the second set of one or more parameter types aredifferent.
 2. The medium of claim 1, wherein the particular set ofinformation is adjacent to the second virtual machine instruction. 3.The medium of claim 1, wherein the particular set of information isindicated in a third virtual machine instruction different from thesecond virtual machine instruction.
 4. The medium of claim 1, whereinthe particular set of information is indicated in a third virtualmachine instruction that precedes the second virtual machineinstruction.
 5. The medium of claim 1, wherein the particular set ofinformation indicates one or more variables, in a constant pool, thatreferences the second set of one or more parameter types.
 6. The mediumof claim 1, wherein the second virtual machine instruction referencesthe first set of one or more parameter types, which is overridden by thesecond set of one or more parameter types referenced by the particularset of information.
 7. The medium of claim 1, wherein the second virtualmachine instruction comprises a data movement operation, and wherein anumber of bytes moved in the data movement operation is determined basedon at least one of the second set of one or more parameter typesreferenced by the particular set of information.
 8. The medium of claim1, wherein performing the particular operation based on the second setof one or more parameter types referenced by the particular set ofinformation comprises: performing the particular operation on aparticular number of bytes in a data structure, wherein the particularnumber is determined based on at least one of the second set of one ormore parameter types referenced by the particular set of information. 9.The medium of claim 1, wherein the second set of one or more parametertypes referenced by the particular set of information comprises ageneric type.
 10. The medium of claim 1, wherein the second set of oneor more parameter types referenced by the particular set of informationis not statically known during a code compilation process that generatesthe set of code.
 11. The medium of claim 1, wherein the second virtualmachine instruction is associated with a third set of one or moreparameter types different from the second set of one or more parametertypes, and wherein the third set of one or more parameter types isdeduced based on one or more virtual machine instructions that wereexecuted before executing the second virtual machine instruction.
 12. Amethod, comprising: identifying a first virtual machine instruction,within a set of code, that includes a particular operation; determiningwhether one or more parameter types associated with the first virtualmachine instruction is modified by any set of information that is (a)within the set of code, and (b) external to the first virtual machineinstruction; responsive to determining that the one or more parametertypes associated with the first virtual machine instruction is notmodified by any set of information that is (a) within the set of code,and (b) external to the first virtual machine instruction: performingthe particular operation based on a first set of one or more parametertypes; identifying a second virtual machine instruction, within the setof code, that includes the particular operation; determining whether oneor more parameter types associated with the second virtual machineinstruction is modified by any set of information that is (a) within theset of code, and (b) external to the second virtual machine instruction;responsive to determining that the one or more parameter typesassociated with the second virtual machine instruction is modified by aparticular set of information that is (a) within the set of code, and(b) external to the second virtual machine instruction: performing theparticular operation based on a second set of one or more parametertypes referenced by the particular set of information, wherein the firstset of one or more parameter types and the second set of one or moreparameter types are different; wherein the method is executed by atleast one device including a hardware processor.
 13. The method of claim12, wherein the particular set of information is adjacent to the secondvirtual machine instruction.
 14. The method of claim 12, wherein theparticular set of information is indicated in a third virtual machineinstruction different from the second virtual machine instruction. 15.The method of claim 12, wherein the particular set of information isindicated in a third virtual machine instruction that precedes thesecond virtual machine instruction.
 16. The method of claim 12, whereinthe particular set of information indicates one or more variables, in aconstant pool, that references the second set of one or more parametertypes.
 17. A system comprising: at least one device including a hardwareprocessor; and the system is configured to perform operationscomprising: identifying a first virtual machine instruction, within aset of code, that includes a particular operation; determining whetherone or more parameter types associated with the first virtual machineinstruction is modified by any set of information that is (a) within theset of code, and (b) external to the first virtual machine instruction;responsive to determining that the one or more parameter typesassociated with the first virtual machine instruction is not modified byany set of information that is (a) within the set of code, and (b)external to the first virtual machine instruction: performing theparticular operation based on a first set of one or more parametertypes; identifying a second virtual machine instruction, within the setof code, that includes the particular operation; determining whether oneor more parameter types associated with the second virtual machineinstruction is modified by any set of information that is (a) within theset of code, and (b) external to the second virtual machine instruction;responsive to determining that the one or more parameter typesassociated with the second virtual machine instruction is modified by aparticular set of information that is (a) within the set of code, and(b) external to the second virtual machine instruction: performing theparticular operation based on a second set of one or more parametertypes referenced by the particular set of information, wherein the firstset of one or more parameter types and the second set of one or moreparameter types are different.
 18. The system of claim 17, wherein theparticular set of information is adjacent to the second virtual machineinstruction.
 19. The system of claim 17, wherein the particular set ofinformation is indicated in a third virtual machine instructiondifferent from the second virtual machine instruction.
 20. The system ofclaim 17, wherein the particular set of information is indicated in athird virtual machine instruction that precedes the second virtualmachine instruction.